Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove CustomDevice, use editablePartitions() method #2572

Merged
merged 2 commits into from
Oct 25, 2022

Conversation

mikee47
Copy link
Contributor

@mikee47 mikee47 commented Oct 24, 2022

This PR tidies up how device in-memory partition tables are updated.

The Device partitions() method returns a read-only (const) reference to the device's PartitionTable suitable for general application use.
A new editablePartitions() method has been added which provides a non-const version so the table can be updated.
This removes the need for the CustomDevice class, which has been removed.

For example:

part = device->createPartition("archive", Storage::Partition::SubType::Data::fwfs, startOffset, size);

becomes:

part = device->editablePartitions().add("archive", Storage::Partition::SubType::Data::fwfs, startOffset, size);

@slaff slaff added this to the 4.7.0 milestone Oct 24, 2022
/**
* @brief Provide full access to partition table
*/
PartitionTable& editable_partitions()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename the method name to use camelCase

Sming/Components/Storage/src/include/Storage/SysMem.h Outdated Show resolved Hide resolved
@mikee47 mikee47 changed the title Remove CustomDevice, use editable_partitions() method Remove CustomDevice, use editablePartitions() method Oct 24, 2022
@slaff slaff merged commit 5a2f49a into SmingHub:develop Oct 25, 2022
@mikee47 mikee47 deleted the feature/editable-partitions branch October 25, 2022 10:43
@slaff slaff mentioned this pull request Nov 8, 2022
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants